import React, { Component } from 'react';
import { Carousel } from 'antd-mobile';

import { withRouter } from 'react-router-dom'
import swiper1 from '@/assets/images/swiper-1.png'
import connect from './connect'

@connect
@withRouter
class Swiper extends Component {
  state = {
    imgHeight: 176,
  }
  render() {
    return (
        <Carousel
          autoplay={false}
          infinite
        >
          {
            this.props.swiper.length > 0
            ?
            this.props.swiper.map((item,index) => (
                <img
                  key={index}
                  src={item.img}
                  alt=""
                  style={{ width: '100%', verticalAlign: 'top' }}
                  onClick = {() => {
                    console.log(this.props.history);
                  }}
                />
            ))
            :
            <img src={swiper1} alt="" style={{ width: '100%', verticalAlign: 'top' }} />

          }
        </Carousel>
    );
  }
}

export default Swiper;
